﻿namespace ACCOUNTING
{
    using ACCOUNTING.LVY.Business;
    using ACCOUNTING.My;
    using ACCOUNTING.My.Resources;
    using C1.Win.C1FlexGrid;
    using C1.Win.C1FlexGrid.Util.BaseControls;
    using Microsoft.VisualBasic.CompilerServices;
    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Diagnostics;
    using System.Drawing;
    using System.Runtime.CompilerServices;
    using System.Windows.Forms;

    [DesignerGenerated]
    public class Frm_DinhNghiaChiNhanh : Form
    {
        private static List<WeakReference> __ENCList = new List<WeakReference>();
        [AccessedThroughProperty("BtPhai")]
        private Button _BtPhai;
        [AccessedThroughProperty("BtTrai")]
        private Button _BtTrai;
        [AccessedThroughProperty("CmdCancel")]
        private Button _CmdCancel;
        [AccessedThroughProperty("CmdChiTiet")]
        private Button _CmdChiTiet;
        [AccessedThroughProperty("CmdMayChu")]
        private Button _CmdMayChu;
        [AccessedThroughProperty("GroupBox1")]
        private GroupBox _GroupBox1;
        [AccessedThroughProperty("GroupBox2")]
        private GroupBox _GroupBox2;
        [AccessedThroughProperty("Panel1")]
        private Panel _Panel1;
        [AccessedThroughProperty("TxtSearchCode")]
        private TextBox _TxtSearchCode;
        [AccessedThroughProperty("TxtSearchName")]
        private TextBox _TxtSearchName;
        [AccessedThroughProperty("VSList")]
        private C1.Win.C1FlexGrid.C1FlexGrid _VSList;
        [AccessedThroughProperty("VSListChiNhanh")]
        private C1.Win.C1FlexGrid.C1FlexGrid _VSListChiNhanh;
        private IContainer components;
        private bool mAllowAdd;
        private bool mAllowDel;
        private bool mAllowEdit;
        private bool mAllowView;
        private DataView objData;
        private clsDMDoiTuong objDT;

        public Frm_DinhNghiaChiNhanh()
        {
            base.Load += new EventHandler(this.Frm_DinhNghiaChiNhanh_Load);
            List<WeakReference> list = __ENCList;
            lock (list)
            {
                __ENCList.Add(new WeakReference(this));
            }
            this.objDT = new clsDMDoiTuong();
            this.InitializeComponent();
        }

        private void BtPhai_Click(object sender, EventArgs e)
        {
            if ((this.VSList.Rows.Count != 1) && (this.VSList.Row > 0))
            {
                this.objDT.SetChiNhanh(1, Conversions.ToString(this.VSList[this.VSList.Row, 0]));
                this.VSListChiNhanh.AddItem("");
                C1.Win.C1FlexGrid.C1FlexGrid vSListChiNhanh = this.VSListChiNhanh;
                vSListChiNhanh[vSListChiNhanh.Rows.Count - 1, 0] = RuntimeHelpers.GetObjectValue(this.VSList[this.VSList.Row, 0]);
                vSListChiNhanh[vSListChiNhanh.Rows.Count - 1, 1] = RuntimeHelpers.GetObjectValue(this.VSList[this.VSList.Row, 1]);
                vSListChiNhanh[vSListChiNhanh.Rows.Count - 1, 2] = RuntimeHelpers.GetObjectValue(this.VSList[this.VSList.Row, 2]);
                vSListChiNhanh = null;
                this.VSList.RemoveItem(this.VSList.Row);
            }
        }

        private void BtTrai_Click(object sender, EventArgs e)
        {
            if ((this.VSListChiNhanh.Rows.Count != 1) && (this.VSListChiNhanh.Row > 0))
            {
                this.objDT.SetChiNhanh(0, Conversions.ToString(this.VSListChiNhanh[this.VSListChiNhanh.Row, 0]));
                this.VSList.AddItem("");
                C1.Win.C1FlexGrid.C1FlexGrid vSList = this.VSList;
                vSList[vSList.Rows.Count - 1, 0] = RuntimeHelpers.GetObjectValue(this.VSListChiNhanh[this.VSListChiNhanh.Row, 0]);
                vSList[vSList.Rows.Count - 1, 1] = RuntimeHelpers.GetObjectValue(this.VSListChiNhanh[this.VSListChiNhanh.Row, 1]);
                vSList[vSList.Rows.Count - 1, 2] = RuntimeHelpers.GetObjectValue(this.VSListChiNhanh[this.VSListChiNhanh.Row, 2]);
                vSList = null;
                this.VSListChiNhanh.RemoveItem(this.VSListChiNhanh.Row);
            }
        }

        private void CmdCancel_Click(object sender, EventArgs e)
        {
            this.Dispose();
        }

        private void CmdChiTiet_Click(object sender, EventArgs e)
        {
            if ((this.VSListChiNhanh.Rows.Count != 1) && (this.VSListChiNhanh.Row > 0))
            {
                MyProject.Forms.Frm_DatabaseChiNhanh.strKhoaDoiTuong = Conversions.ToString(this.VSListChiNhanh[this.VSListChiNhanh.Row, 0]);
                MyProject.Forms.Frm_DatabaseChiNhanh.ShowDialog();
            }
        }

        private void CmdMayChu_Click(object sender, EventArgs e)
        {
            if ((this.VSListChiNhanh.Rows.Count != 1) && (this.VSListChiNhanh.Row > 0))
            {
                MyProject.Forms.Frm_MayChuChiNhanh.strKhoaDoiTuong = Conversions.ToString(this.VSListChiNhanh[this.VSListChiNhanh.Row, 0]);
                MyProject.Forms.Frm_MayChuChiNhanh.ShowDialog();
            }
        }

        [DebuggerNonUserCode]
        protected override void Dispose(bool disposing)
        {
            if (disposing && (this.components != null))
            {
                this.components.Dispose();
            }
            base.Dispose(disposing);
        }

        private void Frm_DinhNghiaChiNhanh_Load(object sender, EventArgs e)
        {
            LVYModule.GetUserRight(ref this.mAllowView, ref this.mAllowDel, ref this.mAllowEdit, ref this.mAllowAdd, Conversions.ToString(this.Tag), modGeneral.H_USERNAME);
            if (!this.mAllowView)
            {
                LVYModule.ShowWarning(modGeneral.Tranlated("Bạn kh\x00f4ng c\x00f3 quyền xem, li\x00ean hệ với người quản trị để biết th\x00eam chi tiết.", ""));
                this.Dispose();
            }
            else
            {
                this.LoadKhachHang();
                this.LoadChiNhanh();
            }
        }

        [DebuggerStepThrough]
        private void InitializeComponent()
        {
            ComponentResourceManager manager = new ComponentResourceManager(typeof(Frm_DinhNghiaChiNhanh));
            this.VSListChiNhanh = new C1.Win.C1FlexGrid.C1FlexGrid();
            this.Panel1 = new Panel();
            this.TxtSearchName = new TextBox();
            this.TxtSearchCode = new TextBox();
            this.CmdCancel = new Button();
            this.BtTrai = new Button();
            this.BtPhai = new Button();
            this.GroupBox2 = new GroupBox();
            this.GroupBox1 = new GroupBox();
            this.VSList = new C1.Win.C1FlexGrid.C1FlexGrid();
            this.CmdChiTiet = new Button();
            this.CmdMayChu = new Button();
            this.VSListChiNhanh.BeginInit();
            this.Panel1.SuspendLayout();
            this.GroupBox2.SuspendLayout();
            this.GroupBox1.SuspendLayout();
            this.VSList.BeginInit();
            this.SuspendLayout();
            this.VSListChiNhanh.AllowEditing = false;
            this.VSListChiNhanh.AutoResize = false;
            this.VSListChiNhanh.BorderStyle = C1.Win.C1FlexGrid.Util.BaseControls.BorderStyleEnum.Light3D;
            this.VSListChiNhanh.ColumnInfo = "3,0,0,0,0,85,Columns:0{Caption:\"Kh\x00f3a\";Visible:False;}\t1{Width:105;Caption:\"M\x00e3 chi nh\x00e1nh\";Style:\"DataType:System.String;TextAlign:LeftCenter;\";}\t2{Caption:\"T\x00ean chi nh\x00e1nh\";}\t";
            this.VSListChiNhanh.ExtendLastCol = true;
            this.VSListChiNhanh.FocusRect = FocusRectEnum.None;
            Point point = new Point(4, 0x13);
            this.VSListChiNhanh.Location = point;
            this.VSListChiNhanh.Name = "VSListChiNhanh";
            this.VSListChiNhanh.Rows.Count = 1;
            this.VSListChiNhanh.Rows.DefaultSize = 0x11;
            this.VSListChiNhanh.SelectionMode = SelectionModeEnum.Row;
            Size size = new Size(0x15b, 0x1a8);
            this.VSListChiNhanh.Size = size;
            this.VSListChiNhanh.StyleInfo = manager.GetString("VSListChiNhanh.StyleInfo");
            this.VSListChiNhanh.TabIndex = 0x35;
            this.VSListChiNhanh.VisualStyle = VisualStyle.Office2007Blue;
            this.Panel1.Controls.Add(this.TxtSearchName);
            this.Panel1.Controls.Add(this.TxtSearchCode);
            point = new Point(2, 0x1bc);
            this.Panel1.Location = point;
            this.Panel1.Name = "Panel1";
            size = new Size(0x15a, 0x1d);
            this.Panel1.Size = size;
            this.Panel1.TabIndex = 0x36;
            point = new Point(0x5b, 3);
            this.TxtSearchName.Location = point;
            this.TxtSearchName.Name = "TxtSearchName";
            size = new Size(0xfb, 20);
            this.TxtSearchName.Size = size;
            this.TxtSearchName.TabIndex = 1;
            point = new Point(0, 3);
            this.TxtSearchCode.Location = point;
            this.TxtSearchCode.Name = "TxtSearchCode";
            size = new Size(90, 20);
            this.TxtSearchCode.Size = size;
            this.TxtSearchCode.TabIndex = 0;
            this.CmdCancel.Image = (Image) manager.GetObject("CmdCancel.Image");
            this.CmdCancel.ImageAlign = ContentAlignment.MiddleLeft;
            point = new Point(0x2a0, 460);
            this.CmdCancel.Location = point;
            this.CmdCancel.Name = "CmdCancel";
            size = new Size(0x49, 0x18);
            this.CmdCancel.Size = size;
            this.CmdCancel.TabIndex = 0x44;
            this.CmdCancel.Text = "Th&o\x00e1t";
            this.CmdCancel.UseVisualStyleBackColor = true;
            this.BtTrai.Font = new Font("Microsoft Sans Serif", 8.25f, FontStyle.Bold, GraphicsUnit.Point, 0xa3);
            point = new Point(0x166, 0xd0);
            this.BtTrai.Location = point;
            this.BtTrai.Name = "BtTrai";
            size = new Size(0x1f, 0x17);
            this.BtTrai.Size = size;
            this.BtTrai.TabIndex = 0x43;
            this.BtTrai.Text = "<";
            this.BtTrai.UseVisualStyleBackColor = true;
            this.BtPhai.Font = new Font("Microsoft Sans Serif", 8.25f, FontStyle.Bold, GraphicsUnit.Point, 0xa3);
            point = new Point(0x166, 0xb3);
            this.BtPhai.Location = point;
            this.BtPhai.Name = "BtPhai";
            size = new Size(0x1f, 0x17);
            this.BtPhai.Size = size;
            this.BtPhai.TabIndex = 0x42;
            this.BtPhai.Text = ">";
            this.BtPhai.UseVisualStyleBackColor = true;
            this.GroupBox2.BackColor = Color.Transparent;
            this.GroupBox2.Controls.Add(this.VSListChiNhanh);
            point = new Point(390, 6);
            this.GroupBox2.Location = point;
            this.GroupBox2.Name = "GroupBox2";
            size = new Size(0x163, 0x1c1);
            this.GroupBox2.Size = size;
            this.GroupBox2.TabIndex = 0x41;
            this.GroupBox2.TabStop = false;
            this.GroupBox2.Text = "Chi nh\x00e1nh";
            this.GroupBox1.BackColor = Color.Transparent;
            this.GroupBox1.Controls.Add(this.Panel1);
            this.GroupBox1.Controls.Add(this.VSList);
            point = new Point(4, 5);
            this.GroupBox1.Location = point;
            this.GroupBox1.Name = "GroupBox1";
            size = new Size(0x160, 0x1dd);
            this.GroupBox1.Size = size;
            this.GroupBox1.TabIndex = 0x40;
            this.GroupBox1.TabStop = false;
            this.GroupBox1.Text = "Danh mục kh\x00e1ch h\x00e0ng";
            this.VSList.AllowEditing = false;
            this.VSList.AutoResize = false;
            this.VSList.BorderStyle = C1.Win.C1FlexGrid.Util.BaseControls.BorderStyleEnum.Light3D;
            this.VSList.ColumnInfo = "3,0,0,0,0,85,Columns:0{Caption:\"Kh\x00f3a\";Visible:False;}\t1{Width:103;Caption:\"M\x00e3 kh\x00e1ch h\x00e0ng\";Style:\"DataType:System.String;TextAlign:LeftCenter;\";}\t2{Caption:\"T\x00ean kh\x00e1ch h\x00e0ng\";}\t";
            this.VSList.ExtendLastCol = true;
            this.VSList.FocusRect = FocusRectEnum.None;
            point = new Point(4, 0x13);
            this.VSList.Location = point;
            this.VSList.Name = "VSList";
            this.VSList.Rows.Count = 1;
            this.VSList.Rows.DefaultSize = 0x11;
            this.VSList.SelectionMode = SelectionModeEnum.Row;
            size = new Size(0x158, 0x1a7);
            this.VSList.Size = size;
            this.VSList.StyleInfo = manager.GetString("VSList.StyleInfo");
            this.VSList.TabIndex = 0x35;
            this.VSList.VisualStyle = VisualStyle.Office2007Blue;
            this.CmdChiTiet.Image = ACCOUNTING.My.Resources.Resources.view;
            this.CmdChiTiet.ImageAlign = ContentAlignment.MiddleLeft;
            point = new Point(0x248, 460);
            this.CmdChiTiet.Location = point;
            this.CmdChiTiet.Name = "CmdChiTiet";
            size = new Size(0x51, 0x18);
            this.CmdChiTiet.Size = size;
            this.CmdChiTiet.TabIndex = 0x45;
            this.CmdChiTiet.Text = "&Local";
            this.CmdChiTiet.UseVisualStyleBackColor = true;
            this.CmdMayChu.Image = ACCOUNTING.My.Resources.Resources.view;
            this.CmdMayChu.ImageAlign = ContentAlignment.MiddleLeft;
            point = new Point(490, 460);
            this.CmdMayChu.Location = point;
            this.CmdMayChu.Name = "CmdMayChu";
            size = new Size(0x57, 0x18);
            this.CmdMayChu.Size = size;
            this.CmdMayChu.TabIndex = 70;
            this.CmdMayChu.Text = "&M\x00e1y chủ";
            this.CmdMayChu.UseVisualStyleBackColor = true;
            SizeF ef = new SizeF(6f, 13f);
            this.AutoScaleDimensions = ef;
            this.AutoScaleMode = AutoScaleMode.Font;
            this.BackgroundImage = ACCOUNTING.My.Resources.Resources.background;
            size = new Size(0x2ed, 0x1e6);
            this.ClientSize = size;
            this.ControlBox = false;
            this.Controls.Add(this.CmdMayChu);
            this.Controls.Add(this.CmdChiTiet);
            this.Controls.Add(this.CmdCancel);
            this.Controls.Add(this.BtTrai);
            this.Controls.Add(this.BtPhai);
            this.Controls.Add(this.GroupBox2);
            this.Controls.Add(this.GroupBox1);
            this.FormBorderStyle = FormBorderStyle.FixedDialog;
            this.MaximizeBox = false;
            this.MinimizeBox = false;
            this.Name = "Frm_DinhNghiaChiNhanh";
            this.StartPosition = FormStartPosition.CenterScreen;
            this.Tag = "BH-0012";
            this.Text = "DINH NGHIA CHI NHANH";
            this.VSListChiNhanh.EndInit();
            this.Panel1.ResumeLayout(false);
            this.Panel1.PerformLayout();
            this.GroupBox2.ResumeLayout(false);
            this.GroupBox1.ResumeLayout(false);
            this.VSList.EndInit();
            this.ResumeLayout(false);
        }

        public void LoadChiNhanh()
        {
            this.objData = new DataView(this.objDT.ShowListByField("Khoa|Ma|Ten" + modGeneral.H_LANGUAGE, " CharIndex('U',Loai) <> 0", ""));
            this.VSListChiNhanh.DataSource = this.objData;
            C1.Win.C1FlexGrid.C1FlexGrid vSListChiNhanh = this.VSListChiNhanh;
            vSListChiNhanh.Cols[0].Visible = false;
            vSListChiNhanh.Cols[1].Width = 80;
            vSListChiNhanh[0, 1] = modGeneral.Tranlated("M\x00e3 kh\x00e1ch h\x00e0ng", "");
            vSListChiNhanh[0, 2] = modGeneral.Tranlated("T\x00ean kh\x00e1ch h\x00e0ng", "");
            vSListChiNhanh = null;
        }

        public void LoadKhachHang()
        {
            this.objData = new DataView(this.objDT.ShowListByField("Khoa|Ma|Ten" + modGeneral.H_LANGUAGE, " CharIndex('C',Loai) <> 0 And CharIndex('U',Loai) = 0", ""));
            this.VSList.DataSource = this.objData;
            C1.Win.C1FlexGrid.C1FlexGrid vSList = this.VSList;
            vSList.Cols[0].Visible = false;
            vSList.Cols[1].Width = 80;
            vSList[0, 1] = modGeneral.Tranlated("M\x00e3 kh\x00e1ch h\x00e0ng", "");
            vSList[0, 2] = modGeneral.Tranlated("T\x00ean kh\x00e1ch h\x00e0ng", "");
            vSList = null;
        }

        internal virtual Button BtPhai
        {
            [DebuggerNonUserCode]
            get
            {
                return this._BtPhai;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                EventHandler handler = new EventHandler(this.BtPhai_Click);
                if (this._BtPhai != null)
                {
                    this._BtPhai.Click -= handler;
                }
                this._BtPhai = value;
                if (this._BtPhai != null)
                {
                    this._BtPhai.Click += handler;
                }
            }
        }

        internal virtual Button BtTrai
        {
            [DebuggerNonUserCode]
            get
            {
                return this._BtTrai;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                EventHandler handler = new EventHandler(this.BtTrai_Click);
                if (this._BtTrai != null)
                {
                    this._BtTrai.Click -= handler;
                }
                this._BtTrai = value;
                if (this._BtTrai != null)
                {
                    this._BtTrai.Click += handler;
                }
            }
        }

        internal virtual Button CmdCancel
        {
            [DebuggerNonUserCode]
            get
            {
                return this._CmdCancel;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                EventHandler handler = new EventHandler(this.CmdCancel_Click);
                if (this._CmdCancel != null)
                {
                    this._CmdCancel.Click -= handler;
                }
                this._CmdCancel = value;
                if (this._CmdCancel != null)
                {
                    this._CmdCancel.Click += handler;
                }
            }
        }

        internal virtual Button CmdChiTiet
        {
            [DebuggerNonUserCode]
            get
            {
                return this._CmdChiTiet;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                EventHandler handler = new EventHandler(this.CmdChiTiet_Click);
                if (this._CmdChiTiet != null)
                {
                    this._CmdChiTiet.Click -= handler;
                }
                this._CmdChiTiet = value;
                if (this._CmdChiTiet != null)
                {
                    this._CmdChiTiet.Click += handler;
                }
            }
        }

        internal virtual Button CmdMayChu
        {
            [DebuggerNonUserCode]
            get
            {
                return this._CmdMayChu;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                EventHandler handler = new EventHandler(this.CmdMayChu_Click);
                if (this._CmdMayChu != null)
                {
                    this._CmdMayChu.Click -= handler;
                }
                this._CmdMayChu = value;
                if (this._CmdMayChu != null)
                {
                    this._CmdMayChu.Click += handler;
                }
            }
        }

        internal virtual GroupBox GroupBox1
        {
            [DebuggerNonUserCode]
            get
            {
                return this._GroupBox1;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._GroupBox1 = value;
            }
        }

        internal virtual GroupBox GroupBox2
        {
            [DebuggerNonUserCode]
            get
            {
                return this._GroupBox2;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._GroupBox2 = value;
            }
        }

        internal virtual Panel Panel1
        {
            [DebuggerNonUserCode]
            get
            {
                return this._Panel1;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._Panel1 = value;
            }
        }

        internal virtual TextBox TxtSearchCode
        {
            [DebuggerNonUserCode]
            get
            {
                return this._TxtSearchCode;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._TxtSearchCode = value;
            }
        }

        internal virtual TextBox TxtSearchName
        {
            [DebuggerNonUserCode]
            get
            {
                return this._TxtSearchName;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._TxtSearchName = value;
            }
        }

        internal virtual C1.Win.C1FlexGrid.C1FlexGrid VSList
        {
            [DebuggerNonUserCode]
            get
            {
                return this._VSList;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._VSList = value;
            }
        }

        internal virtual C1.Win.C1FlexGrid.C1FlexGrid VSListChiNhanh
        {
            [DebuggerNonUserCode]
            get
            {
                return this._VSListChiNhanh;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._VSListChiNhanh = value;
            }
        }
    }
}

